cc.Class({
    'extends': cc.Component,

    properties: {
        // foo: {
        //    default: null,
        //    url: cc.Texture2D,  // optional, default is typeof default
        //    serializable: true, // optional, default is true
        //    visible: true,      // optional, default is true
        //    displayName: 'Foo', // optional
        //    readonly: false,    // optional, default is false
        // },
        // ...
    },

    // use this for initialization
    onLoad: function onLoad() {
        var self = this;
        this.ProgressBarNode = this.node.getChildByName('ProgressBar');
        this.ProgressBar = this.ProgressBarNode.getComponent(cc.ProgressBar);
        this.LabelNode = this.node.getChildByName('Label');
        this.Label = this.LabelNode.getComponent(cc.Label);
        //  = 40;
        this.isLoadingEnd = false;
        this.sch = this.schedule(function () {
            //console.log('progress...')
            if (!this.isLoadingEnd && self.ProgressBar.progress < 1) {
                self.ProgressBar.progress = self.ProgressBar.progress + 0.01;
                self.Label.string = "Loading..." + Math.floor(self.ProgressBar.progress * 100) + "%";
            } else if (!this.isLoadingEnd && self.ProgressBar.progress >= 1) {
                this.unschedule(this.sch);
                this.isLoadingEnd = true;
                cc.director.loadScene('Game');
            } else {}
        }, 0.02);
        //this.scheduleUpdate();
    },

    // called every frame, uncomment this function to activate update callback
    update: function update(dt) {}
    /*if(this.ProgressBar.progress >= 1){
      }*/

    // },
});